//
//  CTCRapidQuestionCell.m
//  CTC
//
//  Created by 李小龙 on 2017/3/21.
//  Copyright © 2017年 jieshuibao. All rights reserved.
//

#import "CTCRapidQuestionCell.h"
#import "HZPhotoGroup.h"

@interface CTCRapidQuestionCell ()
@property (weak, nonatomic) IBOutlet UIImageView *headImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
@property (weak, nonatomic) IBOutlet UILabel *dateLabel;
@property (weak, nonatomic) IBOutlet UIImageView *firstImageView;
@property (weak, nonatomic) IBOutlet UIImageView *secondImageView;

@property (weak, nonatomic) IBOutlet UIImageView *thirdImageView;
@property (weak, nonatomic) IBOutlet UIView *topLayout;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *widthLayout;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *heightLayout;

@property (weak, nonatomic) IBOutlet HZPhotoGroup *photoGroup;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *photoHeightLayout;


@end

@implementation CTCRapidQuestionCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}


- (void)setQuestionModel:(CTCQuestionModel *)questionModel
{
    _questionModel = questionModel;
    
    
    [SDWebImageTool imageView:self.headImageView imageName:questionModel.headImg placeHolder:@"default-head" showProgress:NO];
    _contentLabel.text = questionModel.content;
    _nameLabel.text = questionModel.name;
    _dateLabel.text = [NSDate stringFromTimestamp:questionModel.date];
    
//    if (!questionModel || _showImage == CTCConsultQuestionCellShowImageTypeNone) return;
    

    if (!questionModel || !questionModel.imgs ||(questionModel.imgs.length < 3)) {
        self.photoHeightLayout.constant = 0;
        return;
    }
    
    NSMutableArray *images = [@[] mutableCopy];
    NSArray *arr = [questionModel.imgs componentsSeparatedByString:@","];
    [arr enumerateObjectsUsingBlock:^(NSString *obj, NSUInteger idx, BOOL * _Nonnull stop) {
        [images addObject:[NSString stringWithFormat:@"%@/%@/%@", kMainBaseUrl, kShowImage, obj]];
    }];
    
    _photoGroup.photoItemArray = images;
    self.photoHeightLayout.constant = _photoGroup.height;
    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}





@end
